@echo off
setlocal enabledelayedexpansion
echo.
echo ******************start******************
echo.
set SelfDir=%~dp0
set fileWithPaths=!SelfDir!istempPath.txt
if not exist %fileWithPaths% (
	echo %fileWithPaths% dose not exist!
	goto :exitThisCmd
)
set singlePathStr=
set totalPathStr=
for /f "delims=" %%a in (%fileWithPaths%) do (
	set singlePathStr=%%a
	if defined singlePathStr (
		if not "!singlePathStr:~-1!"==";" (set singlePathStr=!singlePathStr!;)
		set totalPathStr=!totalPathStr!!singlePathStr!
	)
)
echo totalPathStr=!totalPathStr!
set regPath=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
set envName=Path
set envValue=!totalPathStr!
reg add "%regPath%" /v %envName% /t REG_EXPAND_SZ /d "%envValue%" /f
echo.
echo ***************************************************
echo ******                 export                ******
echo ******                  file                 ******
echo ****** %fileWithPaths% ******
echo ******                  to                   ******
echo ******                 PATH                  ******
echo ******                  ok.                  ******
echo ***************************************************
echo.
goto exitOK
:exitThisCmd
echo.
:exitOK
echo.
pause
echo on
